package com.example.mybatis_demo.controller;

import com.example.mybatis_demo.model.UserInfo;
import com.example.mybatis_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-11-29
 * Time: 14:55
 */
@RestController
@RequestMapping("/request")
public class UserController {
    //从service中去拿取所有的userinfo
    @Autowired
    private UserService userService;
    @RequestMapping("/getUserAll")
    public List<UserInfo> getUserAll(){
        return userService.getUserAll();
    }

    @RequestMapping("/login")
    public Boolean login(String name , String password){
        UserInfo userInfo = userService.queryUserByNameAndPassword(name,password);//query查询
        if(userInfo == null){
            return false;
        }
        return true;
    }
}
